home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / spaceambush.swf / scripts / frame_286 / PlaceObject2_247_28 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2007-03-12  |  691 b   |  29 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.amitavaplay == false)
  3.    {
  4.       att = false;
  5.    }
  6.    if(att == true)
  7.    {
  8.       dx = _X - _root.tank._x;
  9.       dy = _Y - _root.tank._y;
  10.       d = Math.sqrt(dx * dx + dy * dy);
  11.       if(50 < d)
  12.       {
  13.          rad = Math.atan2(dy,dx) + 3.141592653589793;
  14.          deg = rad * 180 / 3.141592653589793;
  15.          _rotation = deg;
  16.          b = speed * Math.cos(rad);
  17.          p = speed * Math.sin(rad);
  18.          _X = _X + b;
  19.          _Y = _Y + p;
  20.       }
  21.       else if(0 < _root.amithealth)
  22.       {
  23.          this.gotoAndStop(3);
  24.          _root.tank.truck.gotoAndStop(2);
  25.          _root.tank.turret.gotoAndStop(3);
  26.       }
  27.    }
  28. }
  29.